package com.wntms.ywa.dao;


import com.wntms.ywa.pojo.Auditstatus;
import com.wntms.ywa.pojo.Modify;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

//修改业务
@Mapper
public interface ModifyDao {
//    修改页面查询
    @Select("SELECT a.*,b.name AS rname,b.address AS raddress,b.tel AS rtel,d.name AS pname,d.address AS paddress,d.tel AS ptel,c.* FROM((freight_contract AS a INNER JOIN customer_in AS b ON a.id = b.id) INNER JOIN freight_information AS c ON a.id = c.id) INNER JOIN customer_information AS d ON a.id = d.id where a.id = #{id}")
    public Modify find(Integer id);
//    修改

    @Update("update freight_contract set pay = #{pay} , sdate = #{sdate}, refundtype = #{refundtype}, payment = #{payment} ,auditstatus = #{auditstatus} where id = #{id}")
    public void updateFreightContract(Modify modify);

    @Update("update customer_in set name = #{rname} , address = #{raddress}, tel = #{rtel} where id = #{id}")
    public void updateCustomerIn(Modify modify);

    @Update("update freight_information set weight = #{weight} , volume = #{volume}, breakable = #{breakable} where id = #{id}")
    public void updateFreightInformation(Modify modify);

    @Update("update customer_information set tel = #{ptel} , address = #{paddress}, name = #{pname} where id = #{id}")
    public void updateCustomerInformation(Modify modify);

    @Update("update freight_contract set auditstatus = #{auditstatus} where id = #{id}")
    public void updateAuditstatus(Auditstatus auditstatus);
}
